package com.jrwd.recycletest.mange;

import android.content.Context;
import android.text.TextUtils;

import com.jrwd.recycletest.MyApp;
import com.jrwd.recycletest.util.PostParamsBuilder;
import com.jrwd.recycletest.util.VersionUtil;


/**
 * 相信自己，创造未来
 *
 * @author 小兵
 * @date 2017/10/21
 */

public class Constant {

    /**
     * 应用号
     */
    public static final String APP_NUM = "Ac";
    /**
     * 服务器传递加密参数的key
     */
    public static final String SERVER_PARAM = "data";
    /**
     * 登录密码最小长度
     */
    public static final int PASSWORD_MIN_LENGTH = 6;
    /**
     * 登录密码最大长度
     */
    public static final int PASSWORD_MAX_LENGTH = 15;
    /**
     * 返回数据是否解密
     */
    public static boolean BACK_DATA_DECRYPT = true;

    /**
     * faceID  AppKey
     */
    public static final String FACE_ID_APPKEY = "0n1n-l82aAtzgrDqRxKz8FQwS__80w0g";
    /**
     * faceID  AppSecret
     */
    public static final String FACE_ID_APPSECRET = "lfFo4q5wjzceGa4BMm2Hc8IZbNCYA2cP";
    public static String SCREEN_MONEY_ALL="不限金额";
    public static String SCREEN_TYPE_ALL="不限身份";
    public static String SCREEN_TYPE_WORKER="上班族";
    public static String SCREEN_TYPE_PRISE="企业主";
    public static String SCREEN_TYPE_STUDENT="学生族";
    public static String SCREEN_TYPE_FREEDOM="自由职业";
    public static String[] proTagArr={"推荐","热门","红包","新品","免息","无"};

    public static String[] USER_TYPE={SCREEN_TYPE_ALL,SCREEN_TYPE_WORKER,SCREEN_TYPE_PRISE,
            SCREEN_TYPE_STUDENT,SCREEN_TYPE_FREEDOM};

    public static String[] LOAN_STATUS = {"申请中","申请成功","申请失败","打款成功","待还款","还款成功","逾期"};

    /**
     * 缓存身份證资料的key值
     */
    public static final String CARDINFO_CACHE = "card_info";


    public static PostParamsBuilder postParamsBuilder;

    public static PostParamsBuilder paramsBuilder(Context context){

        postParamsBuilder = new PostParamsBuilder();
        postParamsBuilder.setParams("app_no",APP_NUM);

        if(!TextUtils.isEmpty(UserCache.getChannel(context))){
            postParamsBuilder.setParams("channel_no", UserCache.getChannel(context));
        }else {
            postParamsBuilder.setParams("channel_no", MyApp.channel);
        }
        postParamsBuilder.setParams("app_channel_no",MyApp.channel);
        postParamsBuilder.setParams("version", VersionUtil.getVersionName(context));
        postParamsBuilder.setParams("app_version", VersionUtil.getVersionName(context));
        if(!TextUtils.isEmpty(UserCache.getMobile(context))){
            postParamsBuilder.setParams("mobile", UserCache.getMobile(context));
        }
        if(!TextUtils.isEmpty(UserCache.getSign(context))){
            postParamsBuilder.setParams("sign", UserCache.getSign(context));
        }
        if (!TextUtils.isEmpty(UserCache.getId(context))){
            postParamsBuilder.setParams("uid", UserCache.getId(context));
        }
        return postParamsBuilder;
    }


}
